﻿using DLL.Standard.Infrastructure;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DLL.Net60.AdviceLabel.Entity
{
    public class CAdviceLabel : CNotifyPropertyChanged
    {
        private string _bottleNo = "";

        public string bottleNo
        {
            get { return _bottleNo; }
            set
            {
                if (_bottleNo != value)
                {
                    _bottleNo = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _bedNum = "";

        public string bedNum
        {
            get { return _bedNum; }
            set
            {
                if (_bedNum != value)
                {
                    _bedNum = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _areaName = "";

        public string areaName
        {
            get { return _areaName; }
            set
            {
                if (_areaName != value)
                {
                    _areaName = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _patientName = "";

        public string patientName
        {
            get { return _patientName; }
            set
            {
                if (_patientName != value)
                {
                    _patientName = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _soventSpection = "";

        public string soventSpection
        {
            get { return _soventSpection; }
            set
            {
                if (_soventSpection != value)
                {
                    _soventSpection = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _soventVolume = "";

        public string soventVolume
        {
            get { return _soventVolume; }
            set
            {
                if (_soventVolume != value)
                {
                    _soventVolume = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _drugRealDose = "0";

        public string drugRealDose
        {
            get { return _drugRealDose; }
            set
            {
                if (_drugRealDose != value)
                {
                    _drugRealDose = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _DiluteVolume = "0";

        public string DiluteVolume
        {
            get { return _DiluteVolume; }
            set
            {
                if (_DiluteVolume != value)
                {
                    _DiluteVolume = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _OutVolume = "0";

        public string OutVolume
        {
            get { return _OutVolume; }
            set
            {
                if (_OutVolume != value)
                {
                    _OutVolume = value;
                    this.OnPropertyChanged();
                }
            }
        }

        //剩余剂量
        private string _surplusDose = "0";

        public string surplusDose
        {
            get { return _surplusDose; }
            set
            {
                if (_surplusDose != value)
                {
                    _surplusDose = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _drugName = "";

        public string drugName
        {
            get { return _drugName; }
            set
            {
                if (_drugName != value)
                {
                    _drugName = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _drugCode = "";

        public string drugCode
        {
            get { return _drugCode; }
            set
            {
                if (_drugCode != value)
                {
                    _drugCode = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _drugCount = "0";

        public string drugCount
        {
            get { return _drugCount; }
            set
            {
                if (_drugCount != value)
                {
                    _drugCount = value;
                    this.OnPropertyChanged();
                }
            }
        }

        //抽出溶媒
        private int _outSolvent = 0;

        public int OutSolvent
        {
            get { return _outSolvent; }
            set
            {
                if (_outSolvent != value)
                {
                    _outSolvent = value;
                    this.OnPropertyChanged();
                }
            }
        }

        //停医嘱编号，用来标记连续扫瓶贴都是停药
        private int _stopAdviceID = 1;

        public int StopAdviceID
        {
            get { return _stopAdviceID; }
            set
            {
                if (_stopAdviceID != value)
                {
                    _stopAdviceID = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private int _enable = 1;

        public int Enable
        {
            get { return _enable; }
            set
            {
                if (_enable != value)
                {
                    _enable = value;
                    if (0 == _enable)
                    {
                        //停用
                        ShowDisableLabel = "Visible";
                        ShowEnableLabel = "Hidden";
                    }
                    else if (1 == Enable)
                    {
                        //启用
                        ShowDisableLabel = "Hidden";
                        ShowEnableLabel = "Visible";
                    }
                    this.OnPropertyChanged();
                }
            }
        }

        private int _AdviceHadStop = -1;

        public int AdviceHadStop
        {
            get { return _AdviceHadStop; }
            set
            {
                _AdviceHadStop = value;
                if (0 == AdviceHadStop)
                {
                    //没有停嘱
                    LabelOKShow = "Visible";
                    LabelFailShow = "Hidden";
                }
                else if (1 == AdviceHadStop)
                {
                    //停医嘱
                    LabelOKShow = "Hidden";
                    LabelFailShow = "Visible";
                }
                else
                {
                    //都不显示
                    LabelOKShow = "Hidden";
                    LabelFailShow = "Hidden";
                }
                this.OnPropertyChanged();
            }
        }

        private int _fzzMode = 0;

        public int fzzMode
        {
            get { return _fzzMode; }
            set
            {
                if (_fzzMode != value)
                {
                    _fzzMode = value;
                    if (0 == _fzzMode)
                    {
                        if (("1" == _batch) || ("01" == _batch))
                        {
                            LabelBackground = "#FF40A033";
                            SolventlBackground = "#FF40A033";
                        }
                        else
                        {
                            LabelBackground = "#FFA2E4AF";
                            SolventlBackground = "#FFA2E4AF";
                        }
                    }
                    else
                    {
                        SolventlBackground = "#FFD287A9";
                        LabelBackground = "#FFD287A9";
                    }
                    this.OnPropertyChanged();
                }
            }
        }

        private string _batch = "1";

        public string batch
        {
            get { return _batch; }
            set
            {
                if (_batch != value)
                {
                    _batch = value;
                    if (0 == _fzzMode)
                    {
                        if (("1" == _batch)||("01"==_batch))
                        {
                            LabelBackground = "#FF40A033";
                            SolventlBackground = "#FF40A033";
                        }
                        else
                        {
                            LabelBackground = "#FFA2E4AF";
                            SolventlBackground = "#FFA2E4AF";
                        }
                    }
                    else
                    {
                        SolventlBackground = "#FFD287A9";
                        LabelBackground = "#FFD287A9";
                    }

                    this.OnPropertyChanged();
                }
            }
        }

        //显示瓶贴的背景色
        private string _LabelBackground = "#FF40A033";

        public string LabelBackground
        {
            get { return _LabelBackground; }
            set
            {
                if (_LabelBackground != value)
                {
                    _LabelBackground = value;
                    this.OnPropertyChanged();
                }
            }
        }

        //显示瓶贴的背景色
        private string _solventBackground = "#FF40A033";

        public string SolventlBackground
        {
            get { return _solventBackground; }
            set
            {
                if (_solventBackground != value)
                {
                    _solventBackground = value;
                    this.OnPropertyChanged();
                }
            }
        }

        //医嘱正常显示的界面
        private string _LabelOKShow = "Hidden";

        public string LabelOKShow
        {
            get { return _LabelOKShow; }
            set
            {
                if (_LabelOKShow != value)
                {
                    _LabelOKShow = value;
                    this.OnPropertyChanged();
                }
            }
        }

        //停医嘱显示的界面
        private string _LabelFailShow = "Hidden";

        public string LabelFailShow
        {
            get { return _LabelFailShow; }
            set
            {
                if (_LabelFailShow != value)
                {
                    _LabelFailShow = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _showEnableLabel = "Visible";

        public string ShowEnableLabel
        {
            get { return _showEnableLabel; }
            set
            {
                if (_showEnableLabel != value)
                {
                    _showEnableLabel = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private string _showDisableLabel = "Hidden";

        public string ShowDisableLabel
        {
            get { return _showDisableLabel; }
            set
            {
                if (_showDisableLabel != value)
                {
                    _showDisableLabel = value;
                    this.OnPropertyChanged();
                }
            }
        }

        private int _solventType = 0;

        public int SolventType
        {
            get { return _solventType; }
            set
            {
                if (_solventType != value)
                {
                    _solventType = value;
                    this.OnPropertyChanged();
                }
            }
        }
    }

    public class CAdviceLabels : CNotifyPropertyChanged
    {
        private ObservableCollection<CAdviceLabel> _itemSource = new ObservableCollection<CAdviceLabel>();

        public ObservableCollection<CAdviceLabel> ItemSource
        {
            get { return _itemSource; }
            set
            {
                _itemSource = value;
                this.OnPropertyChanged();
            }
        }

        public void Initialize()
        {
            ItemSource.Clear();
            for (int i = 0; i < 6; i++)
            {
                CAdviceLabel bl = new CAdviceLabel();
                bl.AdviceHadStop = -1;
                ItemSource.Add(bl);
            }
        }

        public CAdviceLabels()
        {
            Initialize();
        }
    }
}